package cp7_jstl_javabean.el;

import bean.UserInfo;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/cp7/el/1")
public class Test1 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setAttribute("a", "zhangsan");
        // 创建一个userinfo对象存入到request中
        UserInfo userInfo = new UserInfo();
        userInfo.setNickname("zhangsan");
        req.setAttribute("user", userInfo);
        req.getRequestDispatcher("/cp7/el-1.jsp").forward(req, resp);
    }
}
